<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
</head>
<body>

</body>

<script>
    /* 字符规则加量词可匹配多个字符，此时量词表示满足该字符规则的字符的出现次数 */
    let str = 'num,num1,num11,num111,num1111';

    /* ?：0次或1次 */
    console.log(str.match(/num1?/g));//['num', 'num1', 'num1', 'num1', 'num1']

    /* *：0次或多次 */
    console.log(str.match(/num1*/g));//['num', 'num1', 'num11', 'num111', 'num1111']

    /* +：1次或多次 */
    console.log(str.match(/num1+/g));//['num1', 'num11', 'num111', 'num1111']

    /* {n}：n次 */
    console.log(str.match(/num1{2}/g));//['num11', 'num11', 'num11']

    /* {n,}：至少n次 */
    console.log(str.match(/num1{2,}/g));//['num11', 'num111', 'num1111']

    /* {n,m}：n到m次 */
    console.log(str.match(/num1{2,3}/g));//['num11', 'num111', 'num111']
</script>
</html>